<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<link rel="stylesheet" href="../../res/layui/css/layui.css" media="all">
<script type="text/javascript" src="../../res/js/jquery-3.1.1.min.js"></script>
<script src="../../res/layui/layui.js"></script>
<script src="../../res/js/Tools.js"></script>
<script type="text/html">

</script>
<body>
<form class="layui-form" action="" lay-filter="example" id="example">
    <button class="layui-btn layui-btn-sm" lay-event="goOut" onclick=daochu()>导出</button>
    <input type="hidden" name="schemeId" id="schemeId">
    <input type="hidden" name="athleteId" id="athleteId">
    <div class="layui-form-item" id="name">
        <label class="layui-form-label">方案名称</label>
            <p name="schemeName" id="schemeName"  ></p>
    </div>

    <div class="layui-form-item" id="year">
        <label class="layui-form-label">方案年度</label>
        <p></p>
    </div>
    <div class="layui-form-item" id="month">
        <label class="layui-form-label">方案月份</label>
        <p  ></p>
    </div>
    <div class="layui-form-item" ID="SDSD">
        <label class="layui-form-label">附件1</label>
        <p  id="test8"></p>
    </div>
    <div class="layui-form-item" ID="two">
        <label class="layui-form-label">附件2</label>
        <p  id="test9"></p>
    </div>
    <div class="layui-form-item" ID="third">
        <label class="layui-form-label">附件3</label>
        <p   id="test10"></p>
    </div>
    <div class="layui-form-item"  id="coachId">
        <label class="layui-form-label">教练姓名</label>
            <p name="coachId"  >
            </p>
    </div>
    <div class="layui-form-item"  id="resultTime">
        <label class="layui-form-label">反馈时间</label>
        <p name="resultTime"  >
        </p>
    </div>
    <div class="layui-form-item"  id="resultEffect">
        <label class="layui-form-label">实施效果</label>
        <p name="resultEffect"  >
        </p>
    </div>
    <div class="layui-form-item"  id="resultFile">
        <label class="layui-form-label">实施附件</label>
        <p name="resultFile"  >
        </p>
    </div>
    <div class="layui-form-item"  id="resultExp">
        <label class="layui-form-label">实施情况</label>
        <p name="resultExp"  >
        </p>
    </div>
    <div class="layui-form-item"  id="creater">
        <label class="layui-form-label">创建者</label>
        <p name="creater"  >
        </p>
    </div>
    <div class="layui-form-item"  id="creatTime">
        <label class="layui-form-label">创建时间</label>
        <p name="creatTime"  >
        </p>
    </div>
    <div class="layui-form-item"  id="applyForTime">
        <label class="layui-form-label">申请时间</label>
        <p name="applyForTime"  >
        </p>
    </div>
    <div class="layui-form-item"  id="applyForExp">
        <label class="layui-form-label">申请理由</label>
        <p name="applyForExp"  >
        </p>
    </div>
    <div class="layui-form-item"  id="auditState">
        <label class="layui-form-label">审核状态</label>
        <p name="applyForExp"  >
        </p>
    </div>
    <div class="layui-form-item"  id="results">
        <label class="layui-form-label">专家咨询结果</label>
        <p name="results"  >
        </p>
    </div>
    <div class="layui-form-item"  id="athleteName">
        <label class="layui-form-label">运动员姓名</label>
        <p name="athleteName"  >
        </p>
    </div>
</form>
<script>
    function daochu(){
        var schemeId = getQueryString("schemeId");
        var url="../../ExportWord/expertWord?schemeId="+schemeId;
        window.open(url);
    }
    layui.use('form',function(){
        var form = layui.form;
        var schemeId = getQueryString("schemeId");
        var url = "../../atsScheme/findById";
        var data = {schemeId:schemeId};
        var url2 = "../../User/findSession";
        //判断用户角色，划分查看权限
        $.post(url2,null,function(obj){

            if(obj.companyId==3){
                $("#SDSD").attr("style","display:none");
                $("#two").attr("style","display:none");
                $("#third").attr("style","display:none");

            }else if(obj.companyId==4){
                $("#resultTime").attr("style","display:none");
                $("#resultEffect").attr("style","display:none");
                $("#resultFile").attr("style","display:none");
                $("#applyForTime").attr("style","display:none");
                $("#applyForExp").attr("style","display:none");
                $("#auditState").attr("style","display:none");
                $("#resultExp").attr("style","display:none");

            }
        },'json')
        //查询数据
        $.post(url,data,function(obj){
            $("#schemeId").val(obj.schemeId);
            $("#name").append(' <p name="schemeName" id="schemeName" style="margin-top:10px;margin-left:100px;padding-top:10px" >'+obj.schemeName+'</p>');
            $("#year").append('<p style="margin-top:10px;margin-left:100px;padding-top:10px" >'+obj.year+'</p>');
            $("#month").append('<p style="margin-top:10px;margin-left:100px;padding-top:10px" >'+obj.month+'</p>');
            $("#SDSD").append('<a href="../../'+obj.file1+'" class="layui-inline layui-upload-choose" style="margin-top:10px;padding-top:10px" target="_bulank" >下载附件1</a>');

            if(obj.file2==null){
                $("#two").append('<span class="layui-inline layui-upload-choose" style="margin-top:0px;padding-top:6px" > </span>');
            }else{
                $("#two").append('<a href="../../'+obj.file2+'" class="layui-inline layui-upload-choose" style="margin-top:0px;padding-top:6px" target="_bulank" >下载附件2</a>');
            }
            if(obj.file3==null){
                $("#third").append('<span class="layui-inline layui-upload-choose" style="margin-top:0px;padding-top:6px" > </span>');
            }else{
                $("#third").append('<a href="../../'+obj.file3+'" class="layui-inline layui-upload-choose" style="margin-top:0px;padding-top:6px" target="_bulank">下载附件3</a>');

            }
            //下拉框
            var url = "../../atsScheme/findselect";
            $.post(url,null,function(data){

                $.each(data,function(index,item){
                    if(item.coachId==obj.coachId){
                        $("#"+obj.coachId).prop("selected","selected");
                        $("#coachId").append('<p style="margin-left:100px;padding-top:10px" >'+obj.coachName+'</p>');

                        form.render("select");

                    }
                    return ;
                });
            });
        });
        //专家
        var url3 = "../../atsScheme/findByIdChakanExpertQuanxian";
        $.post(url3,data,function(obj){
            $("#applyForTime").append('<p style="margin-top:10px;margin-left:100px;padding-top:10px" >'+obj.applyForTime+'</p>');
            $("#applyForExp").append('<p style="margin-top:10px;margin-left:100px;padding-top:10px" >'+obj.applyForExp+'</p>');
            $("#auditState").append('<p style="margin-top:10px;margin-left:100px;padding-top:10px" >'+obj.auditState+'</p>');
      //      $("#results").append('<p style="margin-top:10px;margin-left:100px;padding-top:10px" >'+obj.results+'</p>');
       if(obj.results==null){
           $("#results").append('<p style="margin-top:10px;margin-left:100px;padding-top:10px" > </p>');
       }else{
           $("#results").append('<p style="margin-top:10px;margin-left:100px;padding-top:10px" >'+obj.results+'</p>');

       }
        },'json')
        //
        var url4 = "../../atsScheme/findByIdChakanAthleteQuanxian";
        $.post(url4,data,function(obj){
            $("#athleteName").append('<p style="margin-top:10px;margin-left:100px;padding-top:10px" >'+obj.athleteName+'</p>');

        },'json')

    });

</script>

</body>
</html>